﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace EHR.Ctrls.QueryDesign
{
    public class FilterItemBase : UserControl
    {
        public event EventHandler Clicked;
        public event EventHandler Saved;

        public bool IsEditState
        {
            get { return (bool)GetValue(IsEditStateProperty); }
            set 
            { 
                SetValue(IsEditStateProperty, value);
            }
        }

        // Using a DependencyProperty as the backing store for IsEditState.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty IsEditStateProperty =
            DependencyProperty.Register("IsEditState", typeof(bool), typeof(FilterItemBase), new PropertyMetadata(false));

        public virtual bool Validate()
        { 
            return true;
        }

        protected void RaiseClicked()
        {
            if (Clicked != null)
            {
                Clicked(this, EventArgs.Empty);
            }
        }

        protected void RaiseSaved()
        {
            if (Saved != null)
            {
                Saved(this, EventArgs.Empty);
            }
        }
    }
}
